package com.yanyeori.framework.jira.config;

import com.yanyeori.framework.jira.jiraclient.BasicCredentials;
import com.yanyeori.framework.jira.jiraclient.JiraClient;
import com.yanyeori.framework.jira.jiraclient.JiraException;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Jira config
 *
 * @author chenkuan
 * @since 2023/3/16
 */
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "jira")
public class JiraConfig {

    private String url;
    private String username;
    private String password;

    @Bean
    public JiraClient jiraClient() throws JiraException {
        return new JiraClient(url, new BasicCredentials(username, password));
    }
}
